Skip to content

refactor: Agent framework v2 changes.#796

Merged
Avijit-Microsoft merged 64 commits into
devfrom
km-agentframework-v2
Mar 5, 2026
Merged

refactor: Agent framework v2 changes.#796
Avijit-Microsoft merged 64 commits into
devfrom
km-agentframework-v2

Conversation

@Pavan-Microsoft

Copy link
Copy Markdown
Contributor

Purpose

This pull request introduces several updates to the documentation and infrastructure configuration to support the new agent creation workflow, improve parameter clarity, and enhance integration with the Azure AI Agent Framework. The changes affect deployment scripts, environment variable management, and instructional guides, making it easier for users to set up and customize the solution with agents and other AI components.

Documentation and Workflow Updates:

  • Added instructions and scripts for creating AI agents as part of the post-deployment and setup workflow, including updates to AVMPostDeploymentGuide.md, DeploymentGuide.md, and azure.yaml, and clarified the order of setup steps. [1] [2] [3] [4] [5]
  • Updated environment variable documentation to include new agent and framework parameters, clarifying how these are set during deployment and agent creation (LocalDevelopmentSetup.md). [1] [2]

Infrastructure and Parameter Improvements:

  • Refactored Azure AI Search connection naming for clarity and consistency across outputs and modules in infra/main.bicep, and updated related outputs for agent and API app names. [1] [2] [3] [4] [5] [6]
  • Updated processing scripts and documentation to include new parameters for agent endpoints and solution names, improving usability and extensibility for custom data workflows (DeploymentGuide.md, CustomizeData.md, AVMPostDeploymentGuide.md). [1] [2] [3] [4]

Security and Architecture Documentation:

  • Revised security guidelines to emphasize managed identity usage and removed references to Azure Key Vault as a required component, reflecting architectural changes. [1] [2]
  • Updated the solution overview and architecture documentation to include the Azure AI Agent Framework and clarify service roles.

Miscellaneous:

  • Updated Bicep template metadata to reflect the latest version and template hash.

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

Pavan-Microsoft and others added 30 commits December 4, 2025 11:12
…emove unused agent factory classes, streamline ChatService and HistoryService, and enhance SQLTool for better database interaction. Update API routes and configuration management for improved clarity and performance. Upgrade dependencies in requirements.txt for compatibility with new Azure SDK versions.
…gin, ChatService, HistoryService, and App

- Removed test cases for deprecated agent factories in test_app.py.
- Updated test cases in test_chat_with_data_plugin.py to reflect changes in the ChatWithDataPlugin implementation.
- Refactored test cases in test_chat_service.py to remove dependencies on mock requests and streamline the setup.
- Enhanced test_generate_title in test_history_service.py to utilize the new v2 agent framework.
- Improved error handling tests in test_chat_service.py for rate limits and general exceptions.
- Consolidated mock setups and assertions for clarity and maintainability.
- Updated 00_create_sample_data_files.py to improve CSV and JSON export functions, ensuring better error handling and code readability.
- Modified 01_create_search_index.py to include additional whitespace for consistency.
- Enhanced 03_cu_process_data_text.py by implementing asynchronous processing for embeddings and agent creation, improving performance and scalability.
- Updated 04_cu_process_custom_data.py to streamline the search index creation process and improve error handling.
- Adjusted requirements.txt to include new agent framework dependencies and ensure compatibility.
- Enhanced process_sample_data.sh and run_create_index_scripts.sh to support new solution_name parameter for better configuration management.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the solution to align with the Azure AI Agent Framework v2 workflow by removing the v1 agent-factory lifecycle, shifting agent usage to per-request AI Project clients/providers, and updating infra scripts/docs to create/configure agents post-deployment.

Changes:

  • Removed Semantic Kernel-based agent factories and FastAPI lifespan initialization; updated ChatService/HistoryService to use azure.ai.projects.aio + agent_framework.azure providers.
  • Added/updated deployment & post-deployment scripts to create agents and propagate agent names into App Service / azd env, plus updated infra outputs and docs.
  • Updated tests and dependencies to reflect the v2 SDK and revised request/response behavior (including citation content/title handling).

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/tests/test_app.py Simplifies app fixture now that lifespan agent factories were removed.
src/tests/api/services/test_history_service.py Updates title-generation tests to mock Agent Framework v2 components.
src/tests/api/services/test_chat_service.py Reworks ChatService/ExpCache tests for v2 agent/provider flow and thread deletion.
src/tests/api/plugins/test_chat_with_data_plugin.py Removes plugin tests tied to deleted v1 plugin/factories.
src/tests/api/agents/test_sql_agent_factory.py Removes v1 SQL agent factory tests (factory deleted).
src/tests/api/agents/test_search_agent_factory.py Removes v1 search agent factory tests (factory deleted).
src/tests/api/agents/test_conversation_agent_factory.py Removes v1 conversation agent factory tests (factory deleted).
src/tests/api/agents/test_chart_agent_factory.py Removes v1 chart agent factory tests (factory deleted).
src/tests/api/agents/test_base_agent_factory.py Removes v1 base factory singleton/thread-safety tests (base deleted).
src/api/services/history_service.py Uses async AIProjectClient + AzureAIProjectAgentProvider to generate titles via a configured title agent.
src/api/services/chat_service.py Replaces SK streaming/thread model with v2 project client + provider, conversation_id caching, and citation extraction.
src/api/requirements.txt Updates Azure SDKs and adds agent-framework packages; removes Semantic Kernel dependency.
src/api/plugins/chat_with_data_plugin.py Deletes SK plugin that depended on removed v1 agent factories.
src/api/common/database/sqldb_service.py Adds SQLTool wrapper for tool-calling; enforces Entra auth-only DB connectivity.
src/api/common/config/config.py Adds agent name env vars used by v2 provider-based agent retrieval.
src/api/app.py Removes lifespan-based agent initialization/cleanup.
src/api/api/api_routes.py Instantiates ChatService without Request state; adjusts citation fetch endpoint response shape.
src/api/agents/sql_agent_factory.py Deletes v1 SQL agent factory implementation.
src/api/agents/search_agent_factory.py Deletes v1 search agent factory implementation.
src/api/agents/conversation_agent_factory.py Deletes v1 conversation agent factory implementation.
src/api/agents/chart_agent_factory.py Deletes v1 chart agent factory implementation.
src/api/agents/agent_factory_base.py Deletes v1 base factory singleton helper.
src/api/.env.sample Adds new env vars for v2 agent naming and foundry/app metadata.
src/App/src/components/Citations/Citations.tsx Stores fetched citation title in UI state along with content.
infra/scripts/run_create_index_scripts.sh Passes solution name through to processing script.
infra/scripts/run_create_agents_scripts.sh New script: creates agents, toggles Foundry public access if needed, updates App Service and azd env.
infra/scripts/process_sample_data.sh Adds solution name to required values and passes it into index script runner.
infra/scripts/process_custom_data.sh Adjusts arg ordering and adds solution name; passes into custom processing script.
infra/scripts/index_scripts/requirements.txt Aligns index scripts with v2 projects/agents + agent-framework packages.
infra/scripts/index_scripts/04_cu_process_custom_data.py Migrates embedding + topic mining/mapping logic to async clients and temporary agents (v2).
infra/scripts/index_scripts/03_cu_process_data_text.py Migrates embedding + topic mining/mapping logic to async clients and temporary agents (v2).
infra/scripts/index_scripts/01_create_search_index.py Minor formatting/whitespace update.
infra/scripts/index_scripts/00_create_sample_data_files.py Refactors imports/formatting; removes timestamped filenames.
infra/scripts/agent_scripts/requirements.txt New minimal requirements for agent creation scripts.
infra/scripts/agent_scripts/01_create_agents.py New script to create conversation + title agents (and output their names).
infra/main.waf.parameters.json Updates default image tag to latest_afv2.
infra/main.parameters.json Updates default image tag to latest_afv2.
infra/main.json Updates generated template metadata; introduces AI Search connection name var and new outputs/appsettings.
infra/main.bicep Adds AI Search connection name, emits new outputs/appsettings for agent creation workflow.
documents/LocalDevelopmentSetup.md Documents new v2 environment variables and agent-creation step.
documents/DeploymentGuide.md Adds explicit agent creation step prior to sample data processing.
documents/CustomizingAzdParameters.md Updates default image tag documentation to latest_afv2.
documents/CustomizeData.md Updates custom data script parameter ordering and adds solution name.
documents/AVMPostDeploymentGuide.md Reorders post-deploy steps: create agents, then process sample/custom data.
azure.yaml Updates post-provision messaging to include agent creation script.
README.md Updates solution description/security guidance to reflect Agent Framework and MI-centric setup.
.github/workflows/job-azure-deploy.yml Switches main/default image tag from latest_waf to latest_afv2.
.github/workflows/docker-build.yml Switches main image tag to latest_afv2.
.github/workflows/deploy-KMGeneric.yml Switches main/default image tag to latest_afv2.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread infra/scripts/index_scripts/03_cu_process_data_text.py Outdated
Comment thread infra/scripts/index_scripts/04_cu_process_custom_data.py Outdated
Comment thread src/api/services/chat_service.py
Comment thread src/api/common/config/config.py
Comment thread src/tests/api/services/test_chat_service.py
Comment thread src/tests/api/services/test_history_service.py Outdated
Comment thread documents/LocalDevelopmentSetup.md
@Avijit-Microsoft Avijit-Microsoft merged commit 88ee0c8 into dev Mar 5, 2026
5 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.18.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants